﻿using System.ComponentModel;
namespace Infrastructure
{
    public class ViewModelBase : IViewModel, INotifyPropertyChanged
    {
        private bool _isBusy;
        public bool IsBusy
        {
            get { return _isBusy; }
            set
            {
                _isBusy = value;
                OnPropertyChanged("IsBusy");
            }
        }
        public event PropertyChangedEventHandler PropertyChanged;
        protected virtual void OnPropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
        public IView View { get; set; }
        public ViewModelBase(IView view)
        {
            View = view;
            View.ViewModel = this;
        }
    }  
}
